package com.example.spring_source_code;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.concurrent.atomic.AtomicLong;

@Component
public class Event1 {

    private static final Logger log = LoggerFactory.getLogger(Event1.class);
    @Resource
    private ApplicationContext applicationContext;


    public void sendEvent() {
        log.info("发送短信");
        applicationContext.publishEvent(this);
    }

    public void recive() {
        System.out.println("收到短信");
    }
}
